layout.tsx 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import clsx from "clsx";
  2. import { Viewport } from "next";
  3. import { NextIntlClientProvider } from "next-intl";
  4. import { getMessages } from "next-intl/server";
  5. import { Inter as FontSans } from "next/font/google";
  6. import { ReactNode } from "react";
  7. import "../globals.css";
  8. import PageTransitionEffect from "@/components/PageTransitionEffect";
  9. import { Providers } from "./providers";
  10. // 加载字体
  11. const fontSans = FontSans({
  12. subsets: ["latin"],
  13. variable: "--font-sans",
  14. });
  15. export const viewport: Viewport = {
  16. themeColor: [
  17. { media: "(prefers-color-scheme: light)", color: "white" },
  18. { media: "(prefers-color-scheme: dark)", color: "black" },
  19. ],
  20. };
  21. export const metadata = {
  22. keywords: ["Next.js"],
  23. description: ["Next.js"],
  24. appleWebApp: {
  25. statusBarStyle: 'black',
  26. },
  27. formatDetection: {
  28. email: false,
  29. address: false,
  30. telephone: false,
  31. },
  32. other: {
  33. viewport: ['width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover'],
  34. },
  35. }
  36. export default async function LocaleLayout({
  37. children,
  38. params: { locale },
  39. }: {
  40. children: ReactNode;
  41. params: { locale: string };
  42. }) {
  43. const messages = await getMessages();
  44. return (
  45. <html lang={locale} suppressHydrationWarning>
  46. {/* <Head>
  47. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  48. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover" />
  49. <meta name="keywords" content=""/>
  50. <meta name="description" content=""/>
  51. <meta name="apple-mobile-web-app-capable" content="yes" />
  52. <meta name="apple-mobile-web-app-status-bar-style" content="black" />
  53. <meta name="format-detection" content="telphone=no, email=no" />
  54. <meta http-equiv="Cache-control" content="no-cache, no-store, must-revalidate"/>
  55. <meta http-equiv="Pragma" content="no-cache"/>
  56. <meta http-equiv="Expires" content="0"/>
  57. </Head> */}
  58. <body className={clsx("font-sans", fontSans.variable)}>
  59. <Providers themeProps={{ defaultTheme: "dark", attribute: "class" }}>
  60. <NextIntlClientProvider messages={messages}>
  61. <PageTransitionEffect>{children}</PageTransitionEffect>
  62. </NextIntlClientProvider>
  63. </Providers>
  64. </body>
  65. </html>
  66. );
  67. }